load("//bazel:macros.bzl", "exports_files_legacy", "skia_cc_deps", "split_srcs_and_hdrs")

licenses(["notice"])

exports_files_legacy()

filegroup(
    name = "core_srcs",
    srcs = [
        "SkSLVMCodeGenerator.cpp",
    ],
)

# TODO(kjlubick) Could this be split up so we don't need to compile the SkSLMetalCodeGenerator
# on platforms that don't support metal (e.g. WebGL, Linux)?
GPU_SRCS = [
    "SkSLCodeGenerator.h",
    "SkSLGLSLCodeGenerator.cpp",
    "SkSLGLSLCodeGenerator.h",
    "SkSLMetalCodeGenerator.cpp",
    "SkSLMetalCodeGenerator.h",
    "SkSLPipelineStageCodeGenerator.cpp",
    "SkSLPipelineStageCodeGenerator.h",
    "SkSLSPIRVCodeGenerator.cpp",
    "SkSLSPIRVCodeGenerator.h",
    "SkSLSPIRVtoHLSL.cpp",
    "SkSLSPIRVtoHLSL.h",
    "SkSLWGSLCodeGenerator.cpp",
    "SkSLWGSLCodeGenerator.h",
]

split_srcs_and_hdrs(
    name = "gpu",
    files = GPU_SRCS,
)

filegroup(
    name = "srcs",
    srcs = [
        "SkSLVMCodeGenerator.cpp",
    ] + select({
        "//src/sksl:use_sksl_gpu_srcs": [":gpu_srcs"],
        "//conditions:default": [],
    }),
    visibility = ["//src/sksl:__pkg__"],
)

filegroup(
    name = "private_hdrs",
    srcs = [
        "SkSLVMCodeGenerator.h",
    ] + select({
        "//src/sksl:use_sksl_gpu_srcs": [":gpu_hdrs"],
        "//conditions:default": [],
    }),
    visibility = ["//src/sksl:__pkg__"],
)

skia_cc_deps(
    name = "deps",
    visibility = ["//src/sksl:__pkg__"],
    deps = select({
        "//src/sksl:use_sksl_gpu_srcs": ["@spirv_cross"],
        "//conditions:default": [],
    }),
)
